#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021/7/22 15:36
# @Author  : ldh


from basic.device.Android import Android
from appium.webdriver.common.touch_action import TouchAction

from airtest.core.api import *

class gesturesPwdPage(Android):
    my_info_setting="com.cloudbae.lovenanning: id / my_info_setting" #设置按钮
    hint_layer="com.cloudbae.lovenanning: id / hint_layer_b"  #系统设置蒙层
    item_title="com.cloudbae.lovenanning: id / item_title" #系统设置页各功能按钮，取第1个
    radio_button_img="com.cloudbae.lovenanning: id / radio_button_img" #账户安全页功能按钮，取第2个
    etInputPwd="com.cloudbae.lovenanning: id / etInputPwd" #验证登录密码框
    next_step="com.cloudbae.lovenanning: id / tvCherifyIdentity" #下一步按钮
    btn_dialog_ok="com.cloudbae.lovenanning: id / btn_dialog_ok" #我知道了
    lockPatternView="com.cloudbae.lovenanning: id / lockPatternView" #手势密码绘制区


    #在我的页面点击【设置】
    @classmethod
    def clickSetting(self):
        self.poco(gesturesPwdPage.my_info_setting).click()

    #判断系统设置页是否有蒙层，有则关闭
    @classmethod
    def ifHintLayer(self):
        self.poco(gesturesPwdPage.hint_layer).exists()
        return True

    #关闭系统设置页蒙层
    @classmethod
    def closeHintLayer(self):
        self.poco(gesturesPwdPage.hint_layer).click()

    #在系统设置页点击【账号安全】
    @classmethod
    def clickItem(self):
        self.poco(gesturesPwdPage.item_title[0]).click()

    #在账户安全页点击开启/关闭手势密码
    @classmethod
    def clickGesturesPwd(self):
        self.poco(gesturesPwdPage.radio_button_img[1]).click()

    #验证登录密码
    @classmethod
    def inputPwd(self,pwd):
        self.poco(gesturesPwdPage.etInputPwd).set_text(pwd)
        self.poco(gesturesPwdPage.next_step).click()

    #关闭提示框
    @classmethod
    def closeTips(self):
        self.poco(gesturesPwdPage.btn_dialog_ok).click()

    @classmethod
    def setGesturePwd(self):
        list_pwd=self












